<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>





<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/jquery.ui.core.js"></script>
<script type="text/javascript" src="../js/jquery.ui.datepicker.js"></script>
<link href="../style/jquery-ui-1.8.2.custom.css" rel="stylesheet" type="text/css" />	

</script>

<script>
$(document).ready(function() {
$("#ngaynhap").datepicker({
numberOfMonths: 1,  dateFormat: 'yy/mm/dd',
monthNames: ['Một','Hai','Ba','Tư','Năm','Sáu','Bảy','Tám','Chín', 
'Mười','Mười một','Mười hai'] ,
monthNamesShort: ['Tháng1','Tháng2','Tháng3','Tháng4','Tháng5',
'Tháng6','Tháng7','Tháng8','Tháng9','Tháng10','Tháng11','Tháng12'] ,
dayNames: ['Chủ nhật', 'Thứ hai', 'Thứ ba', 'Thứ tư', 'Thứ năm',
 'Thứ sáu', 'Thứ bảy'],
dayNamesMin: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'] ,
showWeek: true , showOn: 'both',
changeMonth: true , changeYear: true,
currentText: 'Hôm nay', weekHeader: 'Tuần'
});
});
</script>
<link href="../style/css_qt.css" rel="stylesheet" type="text/css" />
<link href="../style/cssqt.css" rel="stylesheet" type="text/css" />

</head>

<body>
<?php
include("../config/config.php");
$masp = $_POST["masp"];
$tensp = $_POST["tensp"];
$matl = $_POST["matl"];

$cannang = $_POST["cannang"];
$chientich = $_POST["chientich"];
$hinh = $_FILES["hinh"]["name"];

$changa = $_POST["changa"];
$maoga = $_POST["maoga"];
$maulong = $_POST["maulong"];

$thangtuoi = $_POST["thangtuoi"];
$giatien = $_POST["giatien"];
$ngaynhap = $_POST["ngaynhap"];

$soluong = $_POST["soluong"];
$thongtinkhac = $_POST["thongtinkhac"];
if(isset($_POST["them"]))
{
$lenhthem = "insert into sanpham values('$masp','$tensp','$matl','$hinh','$cannang','$chientich','$changa','$maoga','$maulong','$thangtuoi','$giatien','$ngaynhap','$soluong','$thongtinkhac')";
$kqthem = mysql_query($lenhthem);
move_uploaded_file($_FILES["hinh"]["tmp_name"],"../image/".$_FILES["hinh"]["name"]);
if($kqthem)
{
	?>
    <script>
	alert('thêm thành công!');
	location.href='indexqt.php?act=ttinsp';
	</script>
   <?php
  
	
}

}

?>
<form action="" method="post" enctype="multipart/form-data" name="formthem" id="formthem" onsubmit="return kiemtrathemlaptop()" >
  <table width="755" border="1" cellspacing="0" cellpadding="0" class="under_table_qt">
    <tr>
      <td height="50" colspan="2" align="center" bgcolor="#FFFF99" class="title_table_qt"><strong>THÊM SẢN PHẨM</strong></td>
    </tr>
    <tr>
      <td width="230" height="50" class="padding_left_qt" >Mã sản phẩm</td>
      <td width="364" height="50"><label for="masp"></label>
      <input name="masp" type="text" class="texte_field_qt"id="masp" placeholder="mã sản phẩm" value="<?php  echo $_POST["masp"];   ?>" /></td>
    </tr>
    <tr>
      <td height="50" class="padding_left_qt" >Tên sản phẩm</td>
      <td height="50"><label for="tensp"></label>
      <input name="tensp" type="text" class="texte_field_qt"id="tensp" placeholder="tên sản phẩm" value="<?php  echo $_POST["tensp"];   ?>" /></td>
    </tr>
    <tr >
      <td height="50" class="padding_left_qt" >Mã thể loại</td>
      <td height="50"><label for="matl"></label>
        <select name="matl" class="texte_field_qt"  id="matl">
        <option value="">--chọn thể loại--</option>
        <?php
		$lenhhang = "select * from theloai";
		$kqhang = mysql_query($lenhhang);
		while($rowhang = mysql_fetch_array($kqhang))
		{
			echo "<option value='$rowhang[0]'>$rowhang[0]</option>";
		}
		?>
        
      </select></td>
    </tr>
    
    <tr >
      <td height="50" class="padding_left_qt">Cân nặng</td>
      <td height="50"><label for="cannang"></label>
        <label for="cannang2"></label>
      <input name="cannang" type="text" class="texte_field_qt" id="cannang2" placeholder="cân nặng" value="<?php  echo $_POST["cannang"];   ?>" /></td>
    </tr>
   
    <tr>
      <td height="50" class="padding_left_qt">Chiến tích</td>
      <td height="50"><label for="chientich"></label>
      <input name="chientich" type="text" class="texte_field_qt"  id="chientich" placeholder="chiến tích" value="<?php  echo $_POST["chientich"];   ?>"/></td>
    </tr>
    <tr>
      <td height="50" class="padding_left_qt" >Hình</td>
      <td height="50"><label for="hinh"></label>
      <input name="hinh" type="file" class="texte_field_qt"  id="hinh" /></td>
    </tr>
    <tr>
      <td height="50" class="padding_left_qt" >Chân gà</td>
      <td height="50"><label for="changa"></label>
      <input name="changa" type="text" class="texte_field_qt" id="changa" placeholder="chân gà" value="<?php  echo $_POST["changa"];   ?>"/></td>
    </tr>
    <tr>
      <td height="50" class="padding_left_qt">Mào gà</td>
      <td height="50"><input name="maoga" type="text"  class="texte_field_qt" id="maoga" placeholder="mào gà" value="<?php  echo $_POST["maoga"];   ?>" /></td>
    </tr>
    
     <tr>
      <td height="50" class="padding_left_qt">Màu lông</td>
      <td height="50"><input name="maulong" type="text" class="texte_field_qt" id="maulong" placeholder="màu lông" value="<?php  echo $_POST["maulong"];   ?>" /></td>
    </tr>
    
     <tr>
      <td height="50" class="padding_left_qt">Tháng tuổi</td>
      <td height="50"><input name="thangtuoi" type="text"  class="texte_field_qt" id="thangtuoi" placeholder="tháng tuổi" value="<?php  echo $_POST["thangtuoi"];   ?>" /></td>
    </tr>
    
     <tr>
      <td height="50" class="padding_left_qt">Giá tiền</td>
      <td height="50"><input name="giatien" type="text" class="texte_field_qt" id="giatien" placeholder="giá tiền" value="<?php  echo $_POST["giatien"];   ?>" /></td>
    </tr>
    
     <tr>
      <td height="50" class="padding_left_qt">Ngày nhập</td>
      <td height="50"><input name="ngaynhap" type="text"  class="texte_field_qt" id="ngaynhap" placeholder="ngày nhập" value="<?php  echo $_POST["ngaynhap"];   ?>" /></td>
    </tr>
    
     <tr>
      <td height="50" class="padding_left_qt">Số lượng</td>
      <td height="50"><input name="soluong" type="text" class="texte_field_qt" id="soluong" placeholder="số lượng" value="<?php  echo $_POST["soluong"];   ?>" /></td>
    </tr>
    
     <tr>
      <td height="50" class="padding_left_qt">Thông tin khác</td>
      <td height="50"><input name="thongtinkhac" type="text" class="texte_field_qt" id="thongtinkhac" placeholder="thông tin khác" value="<?php  echo $_POST["thongtinkhac"];   ?>" /></td>
    </tr>
    
    
    <tr>
      <td height="50" colspan="2" align="center"><input name="them" type="submit" class="button_qt" id="them" value="THÊM SẢN PHẨM"  /></td>
    </tr>
  </table>
</form>

</body>
</html>